<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<html>
<head>
    <title>用户列表</title>
</head>
<body>
<%
    if (request.getSession().getAttribute("modUser_message") != null) {
        out.print("<script>alert(\"" + (request.getSession().getAttribute("modUser_message")) + "\");</script>"); // 弹窗提示
        request.getSession().removeAttribute("modUser_message"); // 删除会话
    } else if (request.getSession().getAttribute("delUser_message") != null) {
        out.print("<script>alert(\"" + (request.getSession().getAttribute("delUser_message")) + "\");</script>"); // 弹窗提示
        request.getSession().removeAttribute("delUser_message"); // 删除会话
    }
%>
<a href="${pageContext.request.contextPath}/admin/index.jsp">返回主页</a>
<table border="1" cellspacing="0px" cellpadding="5px" width="900px">
    <tr>
        <th>ID</th>
        <th>邮箱</th>
        <th>用户名</th>
        <th>密码</th>
        <th>状态</th>
        <th>操作</th>
    </tr>
    <c:forEach items="${requestScope.userList}" var="user">
        <tr>
            <td>${user.id}</td>
            <td>${user.email}</td>
            <td>${user.username}</td>
            <td>${user.password}</td>
            <td>${user.state}</td>
            <td>
                <a href="<c:url value="/admin/AdminUser?method=getUser&id=${user.id}"/>">修改</a>
                <a href="<c:url value="/admin/AdminUser?method=delUser&id=${user.id}"/>">删除</a>
            </td>
        </tr>
    </c:forEach>
</table>
</body>
</html>